Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
Whenever my code runs it just comes up as "javascript"
<!DOCTYPE html>

<html>

<head>

<style>




</style>

</head>

<body>

<script>
//variables//
var x = Math.floor((Math.random() * 5) + 1);
var y;

//variable y//
if (x = 1) {
    y = 'javascript';
} else if (x = 2) {
    y = 'html';
} else if (x = 3) {
    y = 'python';
} else if (x = 4) {
    y = 'swedish';
} else if (x = 5) {
    y = 'your choice';
} else {
    y = 'error';
} 
//what should be printed//
document.write('<h3>' + y + '</h3>');
</script>

</body>

I'm trying to make some javascript code that decides what I am going to focus on for the day but it just comes up as "javascript" whenever I try to load it. I could have a bit of code in the wrong or some invalid syntax, I'm not entirely sure what could be wrong because I'm pretty new to javascript.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!